﻿using MTS;
using SH;
using System.Text.Json.Serialization;

namespace SignalRHub.DTO
{
    public record PvNotifyVerifCalibManagerDto
    {
        /// <summary>
        /// 总任务Id
        /// </summary>
        [JsonPropertyName("general_task_id")]
        public string GeneralTaskId { get; set; }

        /// <summary>
        /// 通知类型：2-检验，3-标定
        /// </summary>
        [JsonPropertyName("mt_mv_type")]
        public SubTaskFlagEnum PvType { get; set; }

        /// <summary>
        /// 子任务
        /// </summary>
        [JsonPropertyName("sub_tasks")]
        public List<SubTask> SubTasks { get; set; }
    }

    public record SubTask
    {
        /// <summary>
        /// 子任务Id
        /// </summary>
        [JsonPropertyName("sub_task_id")]
        public string SubTaskId { get; set; }

        /// <summary>
        /// 扫描次数
        /// </summary>
        [JsonPropertyName("sub_scan_times")]
        public uint ScanTimes { get; set; }

        /// <summary>
        /// 流程编号
        /// </summary>
        [JsonPropertyName("sub_process_number")]
        public string ProcessNumber { get; set; }


        /// <summary>
        /// 扫描结果 0-成功  1-失败  2-未知
        /// </summary>
        [JsonPropertyName("sub_scan_result")]
        public uint ScanResult { get; set; }

        /// <summary>
        /// 重建结果 0-成功  1-失败  2-未知
        /// </summary>
        [JsonPropertyName("sub_rcc_result")]
        public uint RccResult { get; set; }

        /// <summary>
        /// 统计结果 0-成功  1-失败  2-未知
        /// </summary>
        [JsonPropertyName("sub_total_result")]
        public uint TotalResult { get; set; }


        /// <summary>
        /// 子任务详情
        /// </summary>
        [JsonPropertyName("sub_wftask_items")]
        public List<mtWFTaskItem> WFTaskItems { get; set; }

    }

    public enum SubTaskFlagEnum
    {
        /// <summary>
        /// 未知
        /// </summary>
        SUB_TASK_FLAG_UNKNOW = 0,

        /// <summary>
        /// 扫描
        /// </summary>
        SUB_TASK_FLAG_SCAN = 1,

        /// <summary>
        /// 检验
        /// </summary>
        SUB_TASK_FLAG_VERIFY = 2,

        /// <summary>
        /// 标定
        /// </summary>
        SUB_TASK_FLAG_CALIB = 3,

        /// <summary>
        /// 箱体退回
        /// </summary>
        SUB_TASK_FLAG_BoxBack = 4,

        /// <summary>
        /// 箱体送出
        /// </summary
        SUB_TASK_FLAG_BoxSend = 5
    }

    
}
